import HorizontalPlatform
import pygame
image=pygame.image.load("conveyorbelt.jpg")
image.set_colorkey((137,44,75))

class ConveyorBelt(HorizontalPlatform.HorizontalPlatform):
	def __init__(self,pos=(0,0),im=image,rface=True,speed=20):
		HorizontalPlatform.HorizontalPlatform.__init__(self,pos,im)
		self.facingRight=rface
		self.speed=speed
	def process(self):
		k=self.speed if self.facingRight else -self.speed
		for ob in self.boundedList:
			ob.x=ob.x+k if not ob.hangsFromButtom else ob.x-k
	def within_x_boundary(self,ox,ow):
		return HorizontalPlatform.HorizontalPlatform.within_x_boundary(self,ox,ow,k=0.33)
	def clingable(self):
		return False
	def reaction_up(self,objecto):
		HorizontalPlatform.HorizontalPlatform.reaction_up(self,objecto)
		k=self.speed if self.facingRight else -self.speed
		objecto.dx=objecto.dx+k
	def reaction_down(self,objecto):
		HorizontalPlatform.HorizontalPlatform.reaction_down(self,objecto)
		k=self.speed if self.facingRight else -self.speed
		objecto.dx=objecto.dx-k
